#include <vector>
#include <string>
#include <unordered_set>

using namespace std;


class Solution {
public:
    // 300. 最长递增子序列
    // https://leetcode.cn/problems/longest-increasing-subsequence/
    int lengthOfLIS(vector<int>& nums) {
        int n = nums.size();
        int ans = 1;
        vector<int> dp(n, 1);
        for (int i = 1; i<n; ++i)
        {
            for (int j = 0; j<i; ++j)
            {
                if (nums[j] < nums[i])
                    dp[i] = max(dp[i], dp[j]+1);
            }
            ans = max(ans, dp[i]);
        }
        return ans;
    }
};